package com.sls.core.util;

/**
 * 
 * @description 拼装url时，对GBK编码后的特殊字符进行转义
 * @author Wangxuegang
 * @date 2012-9-6
 * 
 */
public class EscapeSpecialChar {

	/**
	 * url中,对GBK编码后的%特殊字符进行转义
	 * 
	 * @param encodeStr
	 * @return
	 */
	public static String escapeSpeCharacter(String encodeStr) {
		StringBuilder strBui = new StringBuilder();
		char[] charArr = encodeStr.toCharArray();
		for (int i = 0; i < charArr.length; i++) {
			char ch = charArr[i];
			if ('%' == ch) {
				strBui.append("%");
				strBui.append("25");
			} else {
				strBui.append(ch);
			}
		}
		String resStr = strBui.toString();

		return resStr;
	}

}
